﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FastKnow.Cache
{
    /// <summary>
    /// 缓存过期策略接口
    /// </summary>
    /// <example>
    /// 下面的示例演示了以相对时间过期策略来缓存对象：
    ///		<code>
    ///			......
    ///			string key = Guid.NewGuid().ToString();
    ///			object cachingObject = new YourCachingObject();
    ///			ICache cache = CacheHelper.GetCache("your cache instance name");
    ///			cache.Add(key, cachingObject, new ExpirationCacheDependency(TimeSpan.FromSeconds(20)));
    ///			......
    ///		</code>
    /// </example>
    public interface ICacheDependency
    {
        /// <summary>
        /// 是否已过期
        /// </summary>
        bool IsExpired { get; }

        /// <summary>
        /// 重置缓存策略（相当于重新开始缓存）
        /// </summary>
        void Reset();
    }
}
